'''
Created on Jul 8, 2009

@author: sternron
'''
import time
import graph
import cliques.mdp.mdpSolver
import cliques.mdp.mdpBasedSearch
import cliques.algorithmRunner
import cProfile
import pstats
import random

def run():
    num_nodes=8
    k=3    
    runner = cliques.algorithmRunner.algorithmRunner()
    test_graph = graph.graph()
    test_graph.generate(num_nodes, num_nodes+4)

    start = time.clock()

    start_1 = time.clock()
    for i in xrange(100):
        test_graph = graph.graph()
        test_graph.generate(num_nodes, num_nodes+4)
        len(test_graph)


    time_1 = time.clock()-start_1
    start_2=time.clock()
    for i in xrange(100):
        test_graph = graph.graph()
        test_graph.generate(num_nodes, num_nodes+4)
        len(test_graph.nodes())
    time_2=time.clock()-start_2
        
#        search = cliques.mdp.mdpBasedSearch.mdpBasedSearch(\
#            cliques.mdp.mdpSolver.smarterCliqueMdpSolver,"smarter-MDP")
#        search.setup(test_graph,k,test_graph.nodes()[0])
#        runner.run(search)    
    end = time.clock()
    print "Total time %f" % (end-start)
    print "len(graph)=%f, len(graph.nodes())=%f" % (time_1,time_2)
    print 2

if __name__ == '__main__':
    cProfile.run("run()","run.profile")
    profile_data = pstats.Stats("run.profile")
    profile_data.strip_dirs()
    profile_data.sort_stats('time')
    profile_data.print_stats(10)
    
    